<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>django.template.loader &mdash; Django 1.7.8.dev20150401230226 documentation</title>
    
    <link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../../',
        VERSION:     '1.7.8.dev20150401230226',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../../_static/doctools.js"></script>
    <link rel="top" title="Django 1.7.8.dev20150401230226 documentation" href="../../../index.html" />
    <link rel="up" title="django.template" href="../template.html" />



 
<script type="text/javascript" src="../../../templatebuiltins.js"></script>
<script type="text/javascript">
(function($) {
    if (!django_template_builtins) {
       // templatebuiltins.js missing, do nothing.
       return;
    }
    $(document).ready(function() {
        // Hyperlink Django template tags and filters
        var base = "../../../ref/templates/builtins.html";
        if (base == "#") {
            // Special case for builtins.html itself
            base = "";
        }
        // Tags are keywords, class '.k'
        $("div.highlight\\-html\\+django span.k").each(function(i, elem) {
             var tagname = $(elem).text();
             if ($.inArray(tagname, django_template_builtins.ttags) != -1) {
                 var fragment = tagname.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + tagname + "</a>");
             }
        });
        // Filters are functions, class '.nf'
        $("div.highlight\\-html\\+django span.nf").each(function(i, elem) {
             var filtername = $(elem).text();
             if ($.inArray(filtername, django_template_builtins.tfilters) != -1) {
                 var fragment = filtername.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + filtername + "</a>");
             }
        });
    });
})(jQuery);
</script>


  </head>
  <body>

    <div class="document">
  <div id="custom-doc" class="yui-t6">
    <div id="hd">
      <h1><a href="../../../index.html">Django 1.7.8.dev20150401230226 documentation</a></h1>
      <div id="global-nav">
        <a title="Home page" href="../../../index.html">Home</a>  |
        <a title="Table of contents" href="../../../contents.html">Table of contents</a>  |
        <a title="Global index" href="../../../genindex.html">Index</a>  |
        <a title="Module index" href="../../../py-modindex.html">Modules</a>
      </div>
      <div class="nav">
    <a href="../../index.html" title="Module code" accesskey="U">up</a></div>
    </div>

    <div id="bd">
      <div id="yui-main">
        <div class="yui-b">
          <div class="yui-g" id="_modules-django-template-loader">
            
  <h1>Source code for django.template.loader</h1><div class="highlight"><pre>
<span class="c"># Wrapper for loading templates from storage of some sort (e.g. filesystem, database).</span>
<span class="c">#</span>
<span class="c"># This uses the TEMPLATE_LOADERS setting, which is a list of loaders to use.</span>
<span class="c"># Each loader is expected to have this interface:</span>
<span class="c">#</span>
<span class="c">#    callable(name, dirs=[])</span>
<span class="c">#</span>
<span class="c"># name is the template name.</span>
<span class="c"># dirs is an optional list of directories to search instead of TEMPLATE_DIRS.</span>
<span class="c">#</span>
<span class="c"># The loader should return a tuple of (template_source, path). The path returned</span>
<span class="c"># might be shown to the user for debugging purposes, so it should identify where</span>
<span class="c"># the template was loaded from.</span>
<span class="c">#</span>
<span class="c"># A loader may return an already-compiled template instead of the actual</span>
<span class="c"># template source. In that case the path returned should be None, since the</span>
<span class="c"># path information is associated with the template during the compilation,</span>
<span class="c"># which has already been done.</span>
<span class="c">#</span>
<span class="c"># Each loader should have an &quot;is_usable&quot; attribute set. This is a boolean that</span>
<span class="c"># specifies whether the loader can be used in this Python installation. Each</span>
<span class="c"># loader is responsible for setting this when it&#39;s initialized.</span>
<span class="c">#</span>
<span class="c"># For example, the eggs loader (which is capable of loading templates from</span>
<span class="c"># Python eggs) sets is_usable to False if the &quot;pkg_resources&quot; module isn&#39;t</span>
<span class="c"># installed, because pkg_resources is necessary to read eggs.</span>

<span class="kn">from</span> <span class="nn">django.core.exceptions</span> <span class="kn">import</span> <span class="n">ImproperlyConfigured</span>
<span class="kn">from</span> <span class="nn">django.template.base</span> <span class="kn">import</span> <span class="n">Origin</span><span class="p">,</span> <span class="n">Template</span><span class="p">,</span> <span class="n">Context</span><span class="p">,</span> <span class="n">TemplateDoesNotExist</span>
<span class="kn">from</span> <span class="nn">django.conf</span> <span class="kn">import</span> <span class="n">settings</span>
<span class="kn">from</span> <span class="nn">django.utils.module_loading</span> <span class="kn">import</span> <span class="n">import_string</span>
<span class="kn">from</span> <span class="nn">django.utils</span> <span class="kn">import</span> <span class="n">six</span>

<span class="n">template_source_loaders</span> <span class="o">=</span> <span class="bp">None</span>


<span class="k">class</span> <span class="nc">BaseLoader</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="n">is_usable</span> <span class="o">=</span> <span class="bp">False</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="k">pass</span>

    <span class="k">def</span> <span class="nf">__call__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">template_name</span><span class="p">,</span> <span class="n">template_dirs</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">load_template</span><span class="p">(</span><span class="n">template_name</span><span class="p">,</span> <span class="n">template_dirs</span><span class="p">)</span>

    <span class="k">def</span> <span class="nf">load_template</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">template_name</span><span class="p">,</span> <span class="n">template_dirs</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="n">source</span><span class="p">,</span> <span class="n">display_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">load_template_source</span><span class="p">(</span><span class="n">template_name</span><span class="p">,</span> <span class="n">template_dirs</span><span class="p">)</span>
        <span class="n">origin</span> <span class="o">=</span> <span class="n">make_origin</span><span class="p">(</span><span class="n">display_name</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">load_template_source</span><span class="p">,</span> <span class="n">template_name</span><span class="p">,</span> <span class="n">template_dirs</span><span class="p">)</span>
        <span class="k">try</span><span class="p">:</span>
            <span class="n">template</span> <span class="o">=</span> <span class="n">get_template_from_string</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">origin</span><span class="p">,</span> <span class="n">template_name</span><span class="p">)</span>
            <span class="k">return</span> <span class="n">template</span><span class="p">,</span> <span class="bp">None</span>
        <span class="k">except</span> <span class="n">TemplateDoesNotExist</span><span class="p">:</span>
            <span class="c"># If compiling the template we found raises TemplateDoesNotExist, back off to</span>
            <span class="c"># returning the source and display name for the template we were asked to load.</span>
            <span class="c"># This allows for correct identification (later) of the actual template that does</span>
            <span class="c"># not exist.</span>
            <span class="k">return</span> <span class="n">source</span><span class="p">,</span> <span class="n">display_name</span>

    <span class="k">def</span> <span class="nf">load_template_source</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">template_name</span><span class="p">,</span> <span class="n">template_dirs</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Returns a tuple containing the source and origin for the given template</span>
<span class="sd">        name.</span>

<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&#39;subclasses of BaseLoader must provide a load_template_source() method&#39;</span><span class="p">)</span>

    <span class="k">def</span> <span class="nf">reset</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Resets any state maintained by the loader instance (e.g., cached</span>
<span class="sd">        templates or cached loader modules).</span>

<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">pass</span>


<span class="k">class</span> <span class="nc">LoaderOrigin</span><span class="p">(</span><span class="n">Origin</span><span class="p">):</span>
    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">display_name</span><span class="p">,</span> <span class="n">loader</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">dirs</span><span class="p">):</span>
        <span class="nb">super</span><span class="p">(</span><span class="n">LoaderOrigin</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="n">display_name</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">loader</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">loadname</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">dirs</span> <span class="o">=</span> <span class="n">loader</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">dirs</span>

    <span class="k">def</span> <span class="nf">reload</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">loader</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">loadname</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">dirs</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>


<span class="k">def</span> <span class="nf">make_origin</span><span class="p">(</span><span class="n">display_name</span><span class="p">,</span> <span class="n">loader</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">dirs</span><span class="p">):</span>
    <span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">TEMPLATE_DEBUG</span> <span class="ow">and</span> <span class="n">display_name</span><span class="p">:</span>
        <span class="k">return</span> <span class="n">LoaderOrigin</span><span class="p">(</span><span class="n">display_name</span><span class="p">,</span> <span class="n">loader</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">dirs</span><span class="p">)</span>
    <span class="k">else</span><span class="p">:</span>
        <span class="k">return</span> <span class="bp">None</span>


<span class="k">def</span> <span class="nf">find_template_loader</span><span class="p">(</span><span class="n">loader</span><span class="p">):</span>
    <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">loader</span><span class="p">,</span> <span class="p">(</span><span class="nb">tuple</span><span class="p">,</span> <span class="nb">list</span><span class="p">)):</span>
        <span class="n">loader</span><span class="p">,</span> <span class="n">args</span> <span class="o">=</span> <span class="n">loader</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">loader</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span>
    <span class="k">else</span><span class="p">:</span>
        <span class="n">args</span> <span class="o">=</span> <span class="p">[]</span>
    <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">loader</span><span class="p">,</span> <span class="n">six</span><span class="o">.</span><span class="n">string_types</span><span class="p">):</span>
        <span class="n">TemplateLoader</span> <span class="o">=</span> <span class="n">import_string</span><span class="p">(</span><span class="n">loader</span><span class="p">)</span>

        <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">TemplateLoader</span><span class="p">,</span> <span class="s">&#39;load_template_source&#39;</span><span class="p">):</span>
            <span class="n">func</span> <span class="o">=</span> <span class="n">TemplateLoader</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="c"># Try loading module the old way - string is full path to callable</span>
            <span class="k">if</span> <span class="n">args</span><span class="p">:</span>
                <span class="k">raise</span> <span class="n">ImproperlyConfigured</span><span class="p">(</span><span class="s">&quot;Error importing template source loader </span><span class="si">%s</span><span class="s"> - can&#39;t pass arguments to function-based loader.&quot;</span> <span class="o">%</span> <span class="n">loader</span><span class="p">)</span>
            <span class="n">func</span> <span class="o">=</span> <span class="n">TemplateLoader</span>

        <span class="k">if</span> <span class="ow">not</span> <span class="n">func</span><span class="o">.</span><span class="n">is_usable</span><span class="p">:</span>
            <span class="kn">import</span> <span class="nn">warnings</span>
            <span class="n">warnings</span><span class="o">.</span><span class="n">warn</span><span class="p">(</span><span class="s">&quot;Your TEMPLATE_LOADERS setting includes </span><span class="si">%r</span><span class="s">, but your Python installation doesn&#39;t support that type of template loading. Consider removing that line from TEMPLATE_LOADERS.&quot;</span> <span class="o">%</span> <span class="n">loader</span><span class="p">)</span>
            <span class="k">return</span> <span class="bp">None</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">return</span> <span class="n">func</span>
    <span class="k">else</span><span class="p">:</span>
        <span class="k">raise</span> <span class="n">ImproperlyConfigured</span><span class="p">(</span><span class="s">&#39;Loader does not define a &quot;load_template&quot; callable template source loader&#39;</span><span class="p">)</span>


<span class="k">def</span> <span class="nf">find_template</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">dirs</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
    <span class="c"># Calculate template_source_loaders the first time the function is executed</span>
    <span class="c"># because putting this logic in the module-level namespace may cause</span>
    <span class="c"># circular import errors. See Django ticket #1292.</span>
    <span class="k">global</span> <span class="n">template_source_loaders</span>
    <span class="k">if</span> <span class="n">template_source_loaders</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
        <span class="n">loaders</span> <span class="o">=</span> <span class="p">[]</span>
        <span class="k">for</span> <span class="n">loader_name</span> <span class="ow">in</span> <span class="n">settings</span><span class="o">.</span><span class="n">TEMPLATE_LOADERS</span><span class="p">:</span>
            <span class="n">loader</span> <span class="o">=</span> <span class="n">find_template_loader</span><span class="p">(</span><span class="n">loader_name</span><span class="p">)</span>
            <span class="k">if</span> <span class="n">loader</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
                <span class="n">loaders</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">loader</span><span class="p">)</span>
        <span class="n">template_source_loaders</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">loaders</span><span class="p">)</span>
    <span class="k">for</span> <span class="n">loader</span> <span class="ow">in</span> <span class="n">template_source_loaders</span><span class="p">:</span>
        <span class="k">try</span><span class="p">:</span>
            <span class="n">source</span><span class="p">,</span> <span class="n">display_name</span> <span class="o">=</span> <span class="n">loader</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">dirs</span><span class="p">)</span>
            <span class="k">return</span> <span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">make_origin</span><span class="p">(</span><span class="n">display_name</span><span class="p">,</span> <span class="n">loader</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">dirs</span><span class="p">))</span>
        <span class="k">except</span> <span class="n">TemplateDoesNotExist</span><span class="p">:</span>
            <span class="k">pass</span>
    <span class="k">raise</span> <span class="n">TemplateDoesNotExist</span><span class="p">(</span><span class="n">name</span><span class="p">)</span>


<div class="viewcode-block" id="get_template"><a class="viewcode-back" href="../../../ref/templates/api.html#django.template.loader.get_template">[docs]</a><span class="k">def</span> <span class="nf">get_template</span><span class="p">(</span><span class="n">template_name</span><span class="p">,</span> <span class="n">dirs</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Returns a compiled Template object for the given template name,</span>
<span class="sd">    handling template inheritance recursively.</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">template</span><span class="p">,</span> <span class="n">origin</span> <span class="o">=</span> <span class="n">find_template</span><span class="p">(</span><span class="n">template_name</span><span class="p">,</span> <span class="n">dirs</span><span class="p">)</span>
    <span class="k">if</span> <span class="ow">not</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">template</span><span class="p">,</span> <span class="s">&#39;render&#39;</span><span class="p">):</span>
        <span class="c"># template needs to be compiled</span>
        <span class="n">template</span> <span class="o">=</span> <span class="n">get_template_from_string</span><span class="p">(</span><span class="n">template</span><span class="p">,</span> <span class="n">origin</span><span class="p">,</span> <span class="n">template_name</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">template</span>

</div>
<span class="k">def</span> <span class="nf">get_template_from_string</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">origin</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Returns a compiled Template object for the given template code,</span>
<span class="sd">    handling template inheritance recursively.</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="k">return</span> <span class="n">Template</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">origin</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span>


<span class="k">def</span> <span class="nf">render_to_string</span><span class="p">(</span><span class="n">template_name</span><span class="p">,</span> <span class="n">dictionary</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">context_instance</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
                     <span class="n">dirs</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Loads the given template_name and renders it with the given dictionary as</span>
<span class="sd">    context. The template_name may be a string to load a single template using</span>
<span class="sd">    get_template, or it may be a tuple to use select_template to find one of</span>
<span class="sd">    the templates in the list. Returns a string.</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">template_name</span><span class="p">,</span> <span class="p">(</span><span class="nb">list</span><span class="p">,</span> <span class="nb">tuple</span><span class="p">)):</span>
        <span class="n">t</span> <span class="o">=</span> <span class="n">select_template</span><span class="p">(</span><span class="n">template_name</span><span class="p">,</span> <span class="n">dirs</span><span class="p">)</span>
    <span class="k">else</span><span class="p">:</span>
        <span class="n">t</span> <span class="o">=</span> <span class="n">get_template</span><span class="p">(</span><span class="n">template_name</span><span class="p">,</span> <span class="n">dirs</span><span class="p">)</span>
    <span class="k">if</span> <span class="ow">not</span> <span class="n">context_instance</span><span class="p">:</span>
        <span class="k">return</span> <span class="n">t</span><span class="o">.</span><span class="n">render</span><span class="p">(</span><span class="n">Context</span><span class="p">(</span><span class="n">dictionary</span><span class="p">))</span>
    <span class="k">if</span> <span class="ow">not</span> <span class="n">dictionary</span><span class="p">:</span>
        <span class="k">return</span> <span class="n">t</span><span class="o">.</span><span class="n">render</span><span class="p">(</span><span class="n">context_instance</span><span class="p">)</span>
    <span class="c"># Add the dictionary to the context stack, ensuring it gets removed again</span>
    <span class="c"># to keep the context_instance in the same state it started in.</span>
    <span class="k">with</span> <span class="n">context_instance</span><span class="o">.</span><span class="n">push</span><span class="p">(</span><span class="n">dictionary</span><span class="p">):</span>
        <span class="k">return</span> <span class="n">t</span><span class="o">.</span><span class="n">render</span><span class="p">(</span><span class="n">context_instance</span><span class="p">)</span>


<div class="viewcode-block" id="select_template"><a class="viewcode-back" href="../../../ref/templates/api.html#django.template.loader.select_template">[docs]</a><span class="k">def</span> <span class="nf">select_template</span><span class="p">(</span><span class="n">template_name_list</span><span class="p">,</span> <span class="n">dirs</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
    <span class="s">&quot;Given a list of template names, returns the first that can be loaded.&quot;</span>
    <span class="k">if</span> <span class="ow">not</span> <span class="n">template_name_list</span><span class="p">:</span>
        <span class="k">raise</span> <span class="n">TemplateDoesNotExist</span><span class="p">(</span><span class="s">&quot;No template names provided&quot;</span><span class="p">)</span>
    <span class="n">not_found</span> <span class="o">=</span> <span class="p">[]</span>
    <span class="k">for</span> <span class="n">template_name</span> <span class="ow">in</span> <span class="n">template_name_list</span><span class="p">:</span>
        <span class="k">try</span><span class="p">:</span>
            <span class="k">return</span> <span class="n">get_template</span><span class="p">(</span><span class="n">template_name</span><span class="p">,</span> <span class="n">dirs</span><span class="p">)</span>
        <span class="k">except</span> <span class="n">TemplateDoesNotExist</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">not_found</span><span class="p">:</span>
                <span class="n">not_found</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
            <span class="k">continue</span>
    <span class="c"># If we get here, none of the templates could be loaded</span>
    <span class="k">raise</span> <span class="n">TemplateDoesNotExist</span><span class="p">(</span><span class="s">&#39;, &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">not_found</span><span class="p">))</span></div>
</pre></div>

          </div>
        </div>
      </div>
      
        
          <div class="yui-b" id="sidebar">
            
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3>Browse</h3>
  <ul>
    
    
  </ul>
  <h3>You are here:</h3>
  <ul>
      <li>
        <a href="../../../index.html">Django 1.7.8.dev20150401230226 documentation</a>
        
          <ul><li><a href="../../index.html">Module code</a>
        
          <ul><li><a href="../../django.html">django</a>
        
          <ul><li><a href="../template.html">django.template</a>
        
        <ul><li>django.template.loader</li></ul>
        </li></ul></li></ul></li></ul>
      </li>
  </ul>

<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../../../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
              <h3>Last update:</h3>
              <p class="topless">Apr 02, 2015</p>
          </div>
        
      
    </div>

    <div id="ft">
      <div class="nav">
    <a href="../../index.html" title="Module code" accesskey="U">up</a></div>
    </div>
  </div>

      <div class="clearer"></div>
    </div>
  </body>
</html>